1. Field of the Invention
The invention relates to computers and computer memory. More particularly, the invention relates to a method, article of manufacture and apparatus for copying information from a source storage medium to a target storage medium.
2. Description of the Background Art
A computer system generally includes at least one memory unit or storage medium to store important data files. To prevent the loss of these data files, the computer system typically performs a periodic backup of the storage medium. The backup of the (source) storage medium copies the contents of the (source) storage medium to another (target) storage medium.
In one method to backup the source storage medium, each file in the source storage medium is individually copied to the target storage medium. This method of xe2x80x9cfile by filexe2x80x9d copying utilizes a directory or list of all files in the source storage medium. Examples of the xe2x80x9cfile by filexe2x80x9d copying include the DOS (disk operating system) xe2x80x9ccopy *.*xe2x80x9d command or the copy of a folder in the Windows operating system. To copy a file, the xe2x80x9cfile by filexe2x80x9d method traverses the list to locate the file, reads the file from the source storage medium and writes the file to the target storage medium.
Although the xe2x80x9cfile by filexe2x80x9d method provides a quick identification of errors identified during copying of the source storage medium, the xe2x80x9cfile by filexe2x80x9d method often requires a high overhead to copy files. First, the copying of each file requires seeking or traversing the directories in both the source and target storage media. Second, the copying of each file requires an update of the directory data in the target storage medium. With source media possibly containing up to hundreds of thousands of files, the cumulative time to traverse and update the directory introduces a considerable delay to copy files from the source storage medium.
In another method to backup the source storage medium, each memory block in the source storage medium is sequentially copied to the target storage medium without regard to what type of data is being copied. An example of this xe2x80x9cblock by blockxe2x80x9d method is the DOS diskcopy command. To copy a block, the xe2x80x9cblock by blockxe2x80x9d method simply reads the block from the source storage medium and writes this block to the target storage medium.
Although the xe2x80x9cblock by blockxe2x80x9d method provides a quick copy of the source storage medium to the target storage medium, the xe2x80x9cblock by blockxe2x80x9d method fails if any errors exist in the source or target storage media. For example, the copying fails if a block in the source storage medium cannot be read. Additionally, the copying fails if a bad block exists in the target storage medium and cannot be moved somewhere else.
Moreover, the xe2x80x9cblock by block xe2x80x9d copying of unused blocks may cause problems in some types of media. For example, magneto optical (MO) disks require an explicit erase of an unused block before rewriting the block with different data. Writing to an unused block without first explicitly erasing the block causes an error during reading of the block. Moreover, if the xe2x80x9cblock by blockxe2x80x9d method attempts to read an explicitly erased block, an optical disk drive would halt the read and initiate an error recovery procedure. However, the error recovery procedure is slow and significantly delays the copying process.
To overcome the disadvantages associated with the conventional xe2x80x9cblock by blockxe2x80x9d copying method, a xe2x80x9cmapxe2x80x9d of source storage medium may be created. The map identifies the used, and erased blocks in the source storage medium. However, if a read error occurs while copying the source storage medium, the location of the read error is unknown. This limits the ability of the computer system to perform error handling on the source storage medium.
Therefore, a need exists for a method and apparatus for copying information from the source storage medium to the target storage medium in an efficient manner, while improving error handling.
The invention provides a method, apparatus and article of manufacture for copying information from a first storage medium to a second storage medium. Specifically, the method initially maps at least one data block and at least one directory block from a plurality of memory blocks contained on the first storage medium. The method then copies each data block from the first storage medium to a second storage medium. If a read error occurs while copying a data block, the method identifies a location of the data block and a data file stored in the data block where the read error occurred. The method then copies each directory block from the first storage medium to the second storage medium.
In another embodiment of the invention, an apparatus comprising a main memory, a source storage medium, and a processor is provided. The main memory stores a disk copy program. The source storage medium contains information to be copied to a target storage medium. The processor performs a method upon executing the disk copy program retrieved from the memory. The method performed initially maps at least one data block and at least one directory block from a plurality of memory blocks contained on a first storage medium. The method then copies each data block from the first storage medium to a second storage medium. If a read error occurs while copying a data block, the method identifies a location of the data block and a data file stored in the data block where the read error occurred. The method then copies each directory block from the first storage medium to the second storage medium.
Additionally, a computer readable medium storing a software program is provided, where the software program, when executed by a processor of a computer, causes the computer to perform a method. In one embodiment of the computer readable medium, the method initially maps at least one data block and at least one directory block from a plurality of memory blocks contained on a first storage medium. The method then copies each data block from the first storage medium to a second storage medium. If a read error occurs while copying a data block, the method identifies a location of the data block and a data file stored in the data block where the read error occurred. The method then copies each directory block from the first storage medium to the second storage medium.